package com.wlc.oop.demo01;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 测试对象
 * @date 2021-06-25 00:29
 */
public class Demo04 {
    public void method01() {
        // 类是抽象的，实例化对象之后，会返回一个自己的实例
        // student1 就是Student 类的一个具体实例。
        Student student1 = new Student();
        student1.name = "张三";
        student1.age = "20";
        Student student2 = new Student();
        student2.name = "小红";
        student2.age = "43";
        student1.study();
        student2.study();
    }

    public void method02() {
        // 通过new 关键字实例化一个对象
        Teacher teacher = new Teacher();
        System.out.println(teacher.name);
        Teacher xiaohong = new Teacher("xiaohong", 23);
        System.out.println(xiaohong.name + "" + xiaohong.age);
    }

    public static void main(String[] args) {
        new Demo04().method02();
    }
}
